<?php
/**
 * Created by PhpStorm.
 * User: zhouxin
 * Date: 2018/9/29
 * Time: 19:45
 */

include 'config.php';



if($_SERVER["REQUEST_METHOD"]=="POST")
{
    if(isset($_POST["telphone"])&&isset($_POST["upwd"]))
    {
        $UTELPHONE=$_POST["telphone"];
        $UPWD=$_POST["upwd"];
        $sqlInset="INSERT INTO userinfo (`user_telphone`,`user_pwd`) VALUE(?,?)";
        $stmt=$conn->prepare($sqlInset);
        $stmt->bind_param("ss",$UTELPHONE,$UPWD);
        $stmt->execute();
        if($stmt->affected_rows>=1)
        {
            print_r(json_encode(array("status"=>1,"msg"=>"注册成功")));
        }
        else{
            print_r(json_encode(array("status"=>-1,"msg"=>"注册失败")));
        }
    }
    else{
        print_r(json_encode(array("status"=>-2,"msg"=>"用户名和密码不能为空")));
    }
}
else{
    print_r(json_encode(array("status"=>0,"msg"=>"不支持的请求方式")));
}
